package com.webframe.service.impl;

import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.webframe.dao.IJdbcDao;
import com.webframe.po.HouseQueryConditionBean;
import com.webframe.service.def.IHouseRentQueryService;

@Service
public class HouseRentQueryService implements IHouseRentQueryService
{
	@Autowired
	private IJdbcDao jdbcDao;
	
	@Override
	public List<Map<String, Object>> getRental(String code)
	{
		String sql = "select rental_code_ id_, rental_label_ name_, low_,high_ from t_rental_range where 1=1";
		if(StringUtils.isNotEmpty(code))
		{
			sql += " and rental_code_=?";
		}
		sql += " order by rental_code_";
		List<Map<String, Object>> list;
		if(StringUtils.isEmpty(code))
		{
			list = jdbcDao.doQueryBySql(sql);
		}
		else
		{
			list = jdbcDao.doQueryBySql(sql, code);
		}
		return list;
	}

	@Override
	public List<Map<String, Object>> getHouseType(String code)
	{
		String sql = "select house_type_code_ id_, house_type_name_ name_, op_ from t_house_type where 1=1";
		if(StringUtils.isNotEmpty(code))
		{
			sql += " and house_type_code_=?";
		}
		sql += " order by house_type_code_";
		List<Map<String, Object>> list;
		if(StringUtils.isEmpty(code))
		{
			list = jdbcDao.doQueryBySql(sql);
		}
		else
		{
			list = jdbcDao.doQueryBySql(sql, code);
		}
		return list;
	}

	@Override
	public List<Map<String, Object>> getFloorType(String code)
	{
		String sql = "select floor_code_ id_, floor_name_ name_, op_ from t_floor_type where 1=1";
		if(StringUtils.isNotEmpty(code))
		{
			sql += " and floor_code_=?";
		}
		sql += " order by floor_code_";
		List<Map<String, Object>> list;
		if(StringUtils.isEmpty(code))
		{
			list = jdbcDao.doQueryBySql(sql);
		}
		else
		{
			list = jdbcDao.doQueryBySql(sql, code);
		}
		return list;
	}

	@Override
	public List<Map<String, Object>> queryHouseRentInfo(HouseQueryConditionBean hqc)
	{
		
		return null;
	}
	
}
